package com.yic.module.mes.framework.datapermission.config;

import com.yic.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import com.yic.module.mes.dal.dataobject.itemproduce.ItemProduceDO;
import com.yic.module.mes.dal.dataobject.mo.MoDO;
import com.yic.module.mes.dal.dataobject.plan.PlanDO;
import com.yic.module.mes.dal.dataobject.process.ProcessDO;
import com.yic.module.mes.dal.dataobject.processRoute.ProcessRouteDO;
import com.yic.module.mes.dal.dataobject.report.ReportDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MES 模块的数据权限 Configuration
 *
 * @author 芋道源码
 */
@Configuration(proxyBeanMethods = false)
public class MesDataPermissionConfiguration {

    @Bean
    public DeptDataPermissionRuleCustomizer mesDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // 工艺
            rule.addFactoryColumn(ProcessDO.class);
            // 工艺路线
            rule.addFactoryColumn(ProcessRouteDO.class);
            // 产品生产信息
            rule.addFactoryColumn(ItemProduceDO.class);
            // 生产计划
            rule.addFactoryColumn(PlanDO.class);
            // 生产工单
            rule.addFactoryColumn(MoDO.class);
            rule.addDeptColumn(MoDO.class);
            // 报工表
            rule.addFactoryColumn(ReportDO.class);
            rule.addDeptColumn(ReportDO.class);
            rule.addUserColumn(ReportDO.class);
        };
    }
}
